<!--
 * @Author: 郭招娣 10615594+guo-zhaodi@user.noreply.gitee.com
 * @Date: 2022-08-17 10:39:38
 * @LastEditors: 郭招娣 10615594+guo-zhaodi@user.noreply.gitee.com
 * @LastEditTime: 2022-08-27 09:45:38
 * @FilePath: \后端管理系统\app\src\views\Rights\index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div>
    <MyBreadcrumb :breadList="$route.meta.breadList" />
  
    <el-card class="box-card">
      <el-table :data="tableData" style="width: 100%">
        <el-table-column type="index"> </el-table-column>
        <el-table-column prop="authName" label="权限名称" >
        </el-table-column>
        <el-table-column prop="path" label="路径" >
        </el-table-column>
        <el-table-column prop="level" label="权限等级" >
          <template slot-scope="scope">
            <el-tag v-if="scope.row.level == 0">一级</el-tag>
            <el-tag v-else-if="scope.row.level == 1" type="success"
              >二级</el-tag
            >
            <el-tag v-if="scope.row.level == 2" type="danger">三级</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import MyBreadcrumb from "../../components/MyBreadcrumb.vue";
import { httpRights } from "../../api/rights";
export default {
  components: {
    MyBreadcrumb,
  },
  data() {
    return {
      tableData: [],
    };
  },
  created() {
    this.initRights();
  },
  methods: {
    async initRights() {
      const res = await httpRights(`/rights/list`);
      console.log(res);
      this.tableData = res.data.data;
    },
  },
};
</script>

<style>
.box-card {
  margin-top: 20px;
}
</style>